package com.physics.mps.entity.dto;

import com.baomidou.mybatisplus.annotation.*;
import com.physics.mps.entity.annotation.ValidAppParam;
import com.physics.mps.entity.enums.TypeEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author mcsoft
 * @since 2023-09-11
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("t_app_param")
@ValidAppParam
public class AppParamEntity implements Serializable {

    private static final long serialVersionUID = 2749880249971082750L;

    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @TableField("param_group_id")
    @NotBlank(message = "paramGroupId不能为空")
    private String paramGroupId;

    @TableField("next_id")
    private String nextId;

    @TableField("name")
    @NotBlank(message = "name不能为空")
    private String name;

    @TableField("param_key")
    @NotBlank(message = "key不能为空")
    private String paramKey;

    @TableField("type")
    @NotNull(message = "type不能为空")
    private Integer type;

    @TableField("value")
    private String value;

    @TableField("description")
    private String description;

    /**
     * 数据类型
     *
     * @see TypeEnum
     */
    @TableField("data_type")
    private int dataType;

    @TableField("data_max_length")
    private int dataMaxLength;

    /**
     * 判断数字是否为0
     * <p>
     * 0表示true，1表示false
     */
    @TableField("zero")
    private int zero;

    @TableField("data_min_length")
    private int dataMinLength;

    @TableField("order_by")
    private int orderBy;

    @TableField("value_list")
    private String valueList;

    @TableField("value_map")
    private String valueMap;

    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private String createBy;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(value = "update_by", fill = FieldFill.UPDATE)
    private String updateBy;

    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;

}
